import { apiGet, apiPost, apiPut, apiDelete } from './client'

export interface Appeal {
  id?: number
  studentId?: number
  offeringId?: number
  itemId?: number
  reason?: string
  status?: string
  result?: string
}

export async function listAppeals(params: { status?: string; offeringId?: number; studentId?: number; offset?: number; limit?: number } = {}) {
  return apiGet<Appeal[]>('/api/grades/appeals', params)
}

export async function createAppeal(appeal: Appeal) {
  return apiPost<Appeal>('/api/grades/appeals', appeal)
}

export async function updateAppeal(id: number, appeal: Appeal) {
  return apiPut<Appeal>(`/api/grades/appeals/${id}`, appeal)
}

export async function deleteAppeal(id: number) {
  return apiDelete<string>(`/api/grades/appeals/${id}`)
}